#include "graph.h"
#include<bits/stdc++.h>
#define For(i,j,k) for(int i=(j);i<=(k);++i)
#define ForDown(i,j,k) for(int i=(j);i>=(k);--i)
#define Debug(fmt, args...) fprintf(stderr,"(func %s, line #%d): " fmt,__func__,__LINE__,##args),fflush(stderr)
#define debug(fmt, args...) fprintf(stderr,fmt,##args),fflush(stderr)
#define within :
using namespace std;
typedef long long ll;
const int N=205;
vector<pair<int,int> >T[N];
vector<pair<int,int> >G[N];
int deg[N],cnt,Tofa[N];
int n,fa[N],dep[N];
int DFS(int fa){
  if(Color()!=1){
    int p=LastRoad();
    int ret=Color()==2?-1:-2;
    Move(p,Color());
    return ret;
  }
  int u=++cnt;::fa[u]=fa;dep[u]=dep[fa]+1;
  deg[u]=NumberOfRoads();
  if(u!=1) Tofa[u]=LastRoad();
  For(i,1,deg[u]) if(i!=Tofa[u]){
    Move(i,2);
    int x=DFS(u);
    if(x==-1) G[u].emplace_back(i,0);
    else if(x>0) T[u].emplace_back(i,x);
  }if(u!=1) Move(Tofa[u],3);return u;
}
void dfs(int u,int pw,int dep=0){
  int p=dep/pw%3+1;
  for(auto& [x,y] within G[u]) if(dep>pw){
    Move(x,p);
    int op=Color();
    Move(LastRoad(),op);
    y+=(op-1)*pw;
  }for(auto [id,x] within T[u]) Move(id,p),dfs(x,pw,dep+1);
  if(u!=1) Move(Tofa[u],p);
}
int g[N][N],ans[N];
void Inspect(int R){
  dep[0]=-1;DFS(0);n=cnt;
  int now=1;
  while(now<n) dfs(1,now),now=now*3;
  memset(g,0x3f,sizeof(g));
  For(i,1,n) g[i][i]=0;
  For(i,1,n) for(auto [id,x] within T[i]) g[i][x]=g[x][i]=1;
  For(i,1,n) for(auto [_,x] within G[i]){
    int now=i,delta=dep[i]-x;
    For(j,1,delta) now=fa[now];
    g[i][now]=g[now][i]=1;
  }For(k,1,n) For(i,1,n) For(j,1,n) g[i][j]=min(g[i][j],g[i][k]+g[k][j]);
  For(i,1,n) For(j,i+1,n) ans[g[i][j]]++;
  For(i,1,R) Answer(i,ans[i]);
}